        <div class="user-accounts-my-ads">
        <div class="back-to-ads">
              <%=link_to image_tag("back-to-ads2.jpg",:border=>"0"),:action=>"recently_posted_ads"-%><br /><br />
        </div>
        	<div class="main-ad2">
    	<div class="ad-header2">
        	<div class="line-one">
            	<%=@advertisment.title -%>
            </div>
            <div class="line-two">
            	<%= @advertisment.location -%>
           	</div>
		</div>
        <div class="ad-tabs2">
            <ul>
                <li> <%=link_to_remote "About", :url=>{:controller=>"login", :action=>"show_advertisment", :id=>@advertisment} ,:update=>"user-accounts-dashboard",:method=>"GET" -%>
                </li>
                <li><%= link_to_remote "Comments",:url => {:action => "comments",:id => @advertisment},:update => "ad-inner2" -%></li>
                <%unless @imagescount ==0 -%>
                  <li><%= link_to_remote  "Photos" ,:url => {:controller=>"advertisments",:action => "full_image",:id => @advertisment,:imageid=>@firstimage.id},:update => "details" -%></li>
                <%end -%>
                <%if  @responses!=0 %>
                <li><a href="">Responses(<%= @responses-%>)</a></li>
                <%end -%>
                                <%count=0%>
                                <%@opposite_category_ids.each do |category| -%>
                                    <%@opposite_subcategory_ids=SubCategory.find(:all,:conditions=>"category_id="+category.id.to_s)-%>
                                      <%@opposite_subcategory_ids.each do |subcategory| -%>
                                        <%count=count+Advertisment.count(:conditions=>"sub_category_id = "+subcategory.id.to_s,:order =>"created_at DESC")%>
                                      <%end -%>
                                <%end -%>

                <li><%= link_to_remote "Relevant Ads("+count.to_s+")",:url => {:action => "relevant_advertisments",:id => @advertisment},:update => "ad-inner2" -%></li>
            </ul>
		</div>
        		<div class="ad-inner2" id="ad-inner2">
        			<div class="ad-options">
            			<div class="ad-edit">
                        	<div class="ad-edit-button">
                            	 <%= link_to image_tag("edit-ad.png", :alt=>"Edit",:border=>"0")-%>
                            </div>
                            <div class="ad-edit-link">
                            	<a href="">Edit</a>
                            </div>
                        </div>
                        <div class="ad-edit">
                        	<div class="ad-edit-button">
                                <%= link_to image_tag("renew-ad.png", :alt=>"Renew",:border=>"0")-%>
                            </div>
                            <div class="ad-edit-link">
                            	<a href="">Renew</a>
                            </div>
                        </div>
                        <div class="ad-edit">
                        	<div class="ad-edit-button">
                                 <%= link_to image_tag("sponsor-ad.png", :alt=>"Sponsor",:border=>"0")-%>
                            </div>
                            <div class="ad-edit-link">
                            	<a href="">Sponsor</a>
                            </div>
                        </div>
                        <div class="ad-edit">
                        	<div class="ad-edit-button">
                             <%= link_to image_tag("promote-ad.png", :alt=>"Promote",:border=>"0")-%>
                            </div>
                            <div class="ad-edit-link">
                            	<a href="">Promote</a>
                            </div>
                        </div>
                        <div class="ad-edit">
                        	<div class="ad-edit-button">
                            <%= link_to image_tag("delete-ad.png", :alt=>"Delete",:border=>"0")-%>
                            </div>
                            <div class="ad-edit-link">
                            	<a href="">Delete</a>
                            </div>
                        </div>
            		</div>
                    <div class="separator12">
                   	  <hr/>
        			</div>
                    <div class="ad-inner-left">
            			<div class="ad-image-column">
                            <div class="ad-edit-image">
                            	<a href="">Change</a>&nbsp;&frasl;&nbsp;<a href="">Remove</a>
                            </div>
                            <div class="ad-image2">
                               
                                <%= link_to image_tag("ad-image.jpg", :alt=>"Enlarge",:border=>"0",:align=>"left",:width=>"170px",:height=>"115px")-%>
                            </div>
                            <div class="enlarge-button2">
                              <%= link_to image_tag("enlarge-icon.jpg", :alt=>"Enlarge",:border=>"0",:align=>"left")-%>
                               
                            </div>
                            <div class="image-icons2">
                                <ul>
                                    <li><%= link_to image_tag("ad-image.jpg", :border=>"0",:width=>"38px",:height=>"26px")-%></li>
                                    <li><%= link_to image_tag("ad-image.jpg", :border=>"0",:width=>"38px",:height=>"26px")-%></li>
                                    <li><%= link_to image_tag("ad-image.jpg", :border=>"0",:width=>"38px",:height=>"26px")-%></li>
                                    <li><%= link_to image_tag("ad-image.jpg", :border=>"0",:width=>"38px",:height=>"26px")-%></li>
                                </ul>
                            </div></div>
                            <div class="comments-button2">
                                <%= link_to image_tag("comments-icon.jpg", :border=>"0")-%>
                            </div>
</div>


            <div class="ad-inner-right" onmouseover="editshow();" onmouseout="edithide();">
                  	<div class="ad-fields-box">
                    	<div class="">
                            <div class="ad-edit2" id="ad-edit2">
                                <div class="ad-edit-button">
                                   <%= link_to image_tag("edit-ad.png", :border=>"0")-%>
                                </div>
                                <div class="ad-edit-link">
                                    <a href="">Edit</a>
                                </div>
                            </div>
                         </div>

                          <%unless @field_values.nil?%>

                                <%@field_values.each do |field_value| -%>
                                    <div class="ad-fields2">
                                      <div class="fields2">
                                      <span style="font-weight:bold"><%=field_value[0].gsub("_"," ").capitalize -%></span> :
                                      </div>
                                      <div class="fields-value2">
                                      <span style="font-weight:normal"><%=field_value[1] -%></span>
                                      </div>
                                    </div>
                                  <%end -%>
                            <%end -%>
                            
                    </div>
                    <div class="separator22">
                    	<hr/>
        			</div>
                    <div class="ad-fields-box">
                    	
                        <div class="ad-fields2">
                            <div class="fields2">
                                Posted on:
                            </div>
                            <div class="fields-value2">
                                <%= @advertisment.created_at.to_formatted_s(:long_ordinal) %>
                           </div>
                        </div>
                        <%if @category_id!=2%>
                        <div class="ad-fields2">
                            <div class="fields2">
                                Expires on:
                            </div>
                            <div class="fields-value2">
                           <%@expires= @advertisment.created_at + @sub_category_lifespan.days -%>
                           <%= @expires.to_formatted_s(:long_ordinal) %>

                           </div>
                        </div>
                        <%end-%>
                        <div class="ad-fields2">
                            <div class="fields2">
                                Posted by:
                            </div>
                            <div class="fields-value2">
                                <%=@user.full_name -%><br/>
                                Student<br/>
                                <%= @university.name %>
                           </div><br/>
                        </div>
                     </div>
                 </div>
                 <div class="separator32">
                    	<hr/>
       			  </div>
					<div class="description2">
                        <div class="description-heading2">
                                 Description
                         </div>
                         <div class="edit-hidden2">
                            <div class="ad-edit2">
                                <div class="ad-edit-button">
                                  <%=image_tag "edit-ad.png", :border=>"0px" -%>
                                </div>
                                <div class="ad-edit-link">
                                    <a href="">Edit</a>
                                </div>
                            </div>
                         </div>
                         <div class="description-text2">
                     <%= @advertisment.description %>
                    </div>
        </div>
        </div>
        </div>

</div>

